package com.coderman.enums;


//系统错误码
public enum ErrCodelEnum {
	success( 0, "成功"),
	error( 1, "系统异常"),
	illegal( 2, "非法操作");
    private int code;
    private String desc;
    
    private ErrCodelEnum(int code, String desc){
        this.code = code;
        this.desc = desc;
    }
    public static String getDescByCode(int code){
        for(ErrCodelEnum refer : ErrCodelEnum.values())
            if(code==refer.getCode())
                return refer.getDesc();
        return null;
    }
    public static ErrCodelEnum getByCode(int code){
    	for(ErrCodelEnum refer : ErrCodelEnum.values())
    		if(code==refer.getCode())
    			return refer;
    	return null;
    }

	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
}